package day10;
import java.io.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class Tihuan {
    public static void main(String[] args) {
        System.out.println((int)'');
        try {
            //BufferedReader br=new BufferedReader(new FileReader("D:\\Documents\\桌面\\exe\\3-java-advance\\chaoxian.txt"));
            BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("D:\\Documents\\桌面\\exe\\3-java-advance\\chaoxian.txt"),"gbk"));
            String str=null;
            CharArrayWriter caw=new CharArrayWriter();//char数组。。。
            while (( str=br.readLine())!=null){//readLine换行符 没有
                str=str.replaceAll("金正恩","金三胖");
                caw.write(str);
                caw.append(System.getProperty("line.separator"));//
                //System.out.println(str);
            }

            br.close();
            FileWriter fw=new FileWriter("e:/temp/朝鲜.txt");
            caw.writeTo(fw);
            fw.close();
            System.out.println("替换成功！");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
